# -*- coding: utf-8 -*-

from odoo import fields, models, _, api


class HrDepartment(models.Model):
    _inherit = "hr.department"

    is_production = fields.Boolean(default=False, string="Production department")
    code = fields.Char(string='部门编号')
    name_en = fields.Char(string='部门英文名称')

    @api.constrains('parent_id')
    def constrains_parent_id(self):
        for record in self:
            if record.parent_id:
                record.is_production = record.parent_id.is_production
